All Questions
50 questions
1vote
1answer
2kviews
Why is Rails not finding my jbuilder template or not rendering it?
I have a route that looks like this: resources :property_searches, :path => 'search' That generates these routes: property_searches GET /search(.:format) ...
0votes
1answer
514views
Rails date range JSON data
I'm looking to have a date range from 1.month.ago..Date.today, then for each day select the maximum temperature (so should get 30 individual numbers), then sum up the results. I obtain the data in ...
0votes
2answers
53views
Store stops working when upgrading to Rails 4.0 from 3.2
I am upgrading my Rails application from v3.2 to v4.0. In my User model I have a JSON coded Store: store :settings, accessors: [ :confirmed, :receive_marketing_emails, :receive_reply_emails ], ...
4votes
2answers
226views
Rails, JSON and loading times
I'm having some loading time issues with my rails app and loading JSON data from a URL source which then is parsed into a graph using the lazy_high_charts gem. Currently it takes the page between 7 - ...
3votes
3answers
2kviews
rails 3.2.0 skip before filter only if it is a json format
1. skip_before_filter :authorize, :only => [:index,:show], :if => proc {|c| request.json?} 2. skip_before_filter :authorize, :only => [:index,:show], :if => :format_json? def ...
0votes
1answer
316views
Parsing JSON Data for Lazy Highcharts
I'm having some issues with parsing some JSON data into high charts using the Lazy Highcharts gem. I'm trying to select only the data from the last 7 days, or 1 week ago. At this stage my application ...
0votes
1answer
111views
Select certain Date data from json Rails
I'm trying to select only results from Date.today + 1.day from a parsed json series, but i have confused myself on how best to implement this. json is formatted as: {"status": "ok", "data": {"...
0votes
1answer
5kviews
Converting Json String to DateTime
I have data in json format that I'm having troubles converting to DateTime to use within my rails app. json data {"status": "ok", "data": [{"2014-06-16 16:00:00": 24.2},{"2014-06-17 12:00:00": 30.2},...
0votes
1answer
189views
JSON data from URL
I'm using Highcharts to display other graphs from csv's in my application, but now I have to access JSON data from a url (test.com/data/data1,temp) and i'm not sure how to best tackle this scenario. ...
41votes
1answer
17kviews
ArgumentError (too few arguments): when calling format.json on rails 4.04
When executing format.json{render json: {}, status: :ok} in Rails 4.0.4, I get the following error: ArgumentError (too few arguments): Although I have another program (with Rails 3.2.13) where the ...
6votes
0answers
3kviews
JBuilder + OJ slow json rendering
I am rendering to json an array of records and their eager-loaded associations. Using ObjectSpace.each_object(ActiveRecord::Base) {|x| 1+1} I get 165 instances, thus my jbuilder views take 1 ...
0votes
1answer
618views
How to accept post request via json on rails?
I have a controller which accepts both html and json format data. I want to know how to accept the data of json format from the POST request from the browser's REST client. Null values are getting ...
0votes
2answers
753views
How to fetch data from table using foreign key using json in rails?
I have a products table where each product has multiple images in Image table on rails application. These two tables are connected using foreign key i.e product_id on Image table. Now I want to fetch ...
0votes
1answer
2kviews
Rails: JSON.pretty_generate(obj) in the controller does not produce pretty output
I need a pretty output of the JSON for an activerecord object in the rails controller. Based on the answer to this question by jpatokal, I tried the following: respond_to do |format| format.json { ...
1vote
2answers
449views
Add nested fields in JSON output in Rails controller
At the end of a standard Rails controller there is: respond_to do |format| format.html format.json { render json: @cars } end Works as expected. Except the JSON doesn't have the associations of @...